﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace Common
{
    [XmlRoot("TalkbackRule", IsNullable = false, Namespace = "")]
    public class TalkbackRule
    {
        [XmlIgnore]
        public static readonly string ArticleIDToken = "ArticleID",
        TalkbackIDToken = "TALKBACKIDTOKEN", ContentTypeID1Token = "ContentTypeID1",
        ContentTypeID2Token = "ContentTypeID2",
        TimeToken = "TIMETOKEN", DateToken = "DATETOKEN", DateTimeToken = "DATETIMETOKEN",
        TalkbackNumberToken = "TALKBACKNUMBERTOKEN", ContentToken = "CONTENTTOKEN",
        TitleToken = "TITLETOKEN", WILDCARDTOKEN = @"\*", NUMBERTOKEN = "NUMBERTOKEN",
        PARENTNUMBERTOKEN = "PARENTNUMBERTOKEN",
        TEXTTOKEN = "TEXTTOKEN", GlobesDateToken = "GLOBESDATE",
        CURRENT_HOST_TOKEN = "CURRENT_HOST_TOKEN", AuthorToken = "AUTHORTOKEN";

        public bool ArticleContainsTalkbacks;
        public string ArticleIDExtractExpression;
//        public string ArticleID;
        public string TalkbackGenericUrl;
        public bool StripNewlinesAndTabs = false;
        public List<string> MatchingRules;
        public string TalkbackEncoding;

        //public UrlContainsOneTalkback UrlContainsOneTalkback;
        //public UrlContainsAllTalkbacks UrlContainsAllTalkbacks;
        public UrlContainsOneTalkbackContent UrlContainsOneTalkbackContent;
        public bool UrlContainsArticleID;

        public TalkbackRule()
        {
            //UrlContainsOneTalkback = new UrlContainsOneTalkback();
            //UrlContainsAllTalkbacks = new UrlContainsAllTalkbacks();
        }
    }

    [XmlRoot("UrlContainsOneTalkbackContent", IsNullable = true, Namespace = "")]
    public class UrlContainsOneTalkbackContent
    {
        public string GenericContentUrl;
        public string TextExtractExpression;
        //public RuleSet HtmlParsingRuleSet;
    }

    [XmlRoot("UrlContainsArticleID", IsNullable = true, Namespace = "")]
    public class UrlContainsArticleID
    {
        public string ArticleIDExtractExpression;
    }
    /*
    public class UrlTalkback
    {
        public string TalkbackGenericUrl;
        public List<string> MatchingRules;
    }

    [XmlRoot("UrlContainsOneTalkback", IsNullable = true, Namespace = "")]
    public class UrlContainsOneTalkback : UrlTalkback
    {
        public RuleSet HtmlParsingRuleSet;

        public UrlContainsOneTalkback()
        {
            HtmlParsingRuleSet = new RuleSet();
        }

    }

    [XmlRoot("UrlContainsAllTalkbacks", IsNullable = true, Namespace = "")]
    public class UrlContainsAllTalkbacks : UrlTalkback
    {
        public UrlContainsOneTalkbackContent UrlContainsOneTalkbackContent;
        //public RuleSet HtmlParsingRuleSet;
    }
    */
  

    





}
